<?php

namespace Parser;

use Parser\Separator\baseSeparator;
use ReflectionException;

/**
 * Class Analysis
 * @author LS(Copy from callcenter)
 * @package App\Common\Insurance\Parser
 */
class Analysis
{
    private $parser;

    public static $kindNameList = [
        '机动车损失保险' => '3000',
        '玻璃单独破碎险' => '3001',
        '车身划痕损失险' => '3002',
        '自燃损失险' => '3003',
        '第三者责任保险' => '4000',
        '机动车全车盗窃保险' => '6000',
        '机动车机动车车上人员责任保险（司机）' => '5002',
        '机动车机动车车上人员责任保险（乘客）' => '5001',
        '机动车损失保险无法找到第三方特约险' => '7002',
        '发动机涉水损失险' => '3004',
        '不计免赔险（车身划痕损失险）' => '30021',
        '不计免赔险（三者险）' => '40001',
        '不计免赔险（车损险）' => '30001',
        '不计免赔险（自燃损失险）' => '30031',
        '不计免赔险（盗抢险）' => '60001',
        '不计免赔险（车上人员（司机））' => '50021',
        '不计免赔险（车上人员（乘客））' => '50011',
        '不计免赔险（发动机涉水损失险）' => '30041',
    ];

    public $result;

    public function __construct(parser $parser)
    {
        $this->parser = $parser;
    }

    /**
     * @throws ReflectionException
     */
    public function separation()
    {

        $className = "Parser\\Separator\\" . $this->parser->insureSource;

        $source = (new \ReflectionClass($className))->newInstance();

        $separator = $source;

        $separator->interpreter($this->parser->rawData ?: [], $this->parser);
    }
}

